/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.isfd.domain.bo;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;

import java.util.List;

@Data
public class IsfdMeshSectionInfoConfigBo {
    private String keyword;
    private String name;
    private List<IsfdMeshSectionInfoConfigBo> children;

    public IsfdMeshSectionInfoConfigBo() {
    }

    public IsfdMeshSectionInfoConfigBo(String keyword, String name) {
        this.keyword = keyword;
        this.name = name;
    }

    public IsfdMeshSectionInfoConfigBo(String keyword, String name, List<IsfdMeshSectionInfoConfigBo> children) {
        this.keyword = keyword;
        this.name = name;
        this.children = children;
    }

    public static List<IsfdMeshSectionInfoConfigBo> init(String sectionInfoConfig) throws JsonProcessingException {
        ObjectMapper objectMapper = new ObjectMapper();
        return objectMapper.readValue(sectionInfoConfig, objectMapper.getTypeFactory().constructCollectionType(List.class, IsfdMeshSectionInfoConfigBo.class));
    }
}
